package com.lingCheng.avg.entity;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description: 返回前端工具类
 * @author: kite
 * @create: 2021/1/15 9:54
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonData {

    private Integer code;
    private String msg;
    private Object data;

    public static JsonData Success(String msg) {
        return new JsonData(200, msg, null);
    }

    public static JsonData Success() {
        return new JsonData(200, "success", null);
    }

    public static JsonData Success(Object data) {
        return new JsonData(200, "success", data);
    }

    public static JsonData Success(String msg, Object data) {
        return new JsonData(200, msg, data);
    }

    public static JsonData Error(String msg) {
        return new JsonData(503, msg, null);
    }
}
